<template>
  <div id="app">
    <h2>测试题</h2>
    <SubjectItem
      v-for="v of 5"
      :key="v"
      @submit="onSubmit(v - 1, $event)"
    ></SubjectItem>
    <div>
      <FlagItem
        v-for="v of 5"
        :key="v"
        :no="v"
        :result="results[v - 1]"
      ></FlagItem>
    </div>
  </div>
</template>

<script>
import SubjectItem from "@/components/SubjectItem.vue";
import FlagItem from "@/components/FlagItem.vue";
export default {
  name: "App",
  components: { SubjectItem, FlagItem },
  data() {
    return {
      results: ["未完成", "未完成", "未完成", "未完成", "未完成"],
    };
  },
  methods: {
    onSubmit(i, textResult) {
      this.results.splice(i, 1, textResult);
    },
  },
};
</script>

<style>
body {
  background-color: #eee;
}

#app {
  background-color: #fff;
  width: 500px;
  margin: 50px auto;
  box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.5);
  padding: 2em;
}
</style>